/*
 * Coding by Zhonghua. from 18-9-14 下午5:56.
 */

package cn.iotnova.opus.utils;

import androidx.annotation.NonNull;

/**
 * JNI操作
 */
public class OpusUtils {
    public static final native long createEncoder(int sampleRateInHz, int channelConfig, int complexity);
    public static final native long createDecoder(int sampleRateInHz, int channelConfig);
    public static final native int encode(long handle, @NonNull short[] lin, int offset, @NonNull byte[] encoded);
    public static final native int decode(long handle, @NonNull byte[] encoded, @NonNull short[] lin);
    public static final native void destroyEncoder(long handle);
    public static final native void destroyDecoder(long handle);

    static {
        System.loadLibrary("opusJni");
    }
}